package com.example.pulsame233;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.Button;

public class MainActivity extends Activity {


	private Button _boton;
	private int numVeces=0;
	private static final String TAG = "Pulsame233";
	
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		_boton = new Button(this);
		_boton.setText("¡Pulsame!");
		_boton.setOnClickListener(new View.OnClickListener(){
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				botonPulsado();
			}

		}
			);
		//setContentView(R.layout.activity_pulsame);
		setContentView(_boton);
	}

	private void botonPulsado() {
		// TODO Auto-generated method stub
		++numVeces;
		_boton.setText("Pulsado: "+numVeces+" veces");
		//System.out.println("Pulsado: "+numVeces+" veces");
		android.util.Log.d(TAG,"BotonPulsado "+ numVeces);
	}
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
